<?php
/*
 * mk script created on 13-mag-2005
 * jaco_at_pixeldump_dot_org
 * overlapping shapes
 */

include("sample_utils.php");                // provides some utils and using mk

function draw_many_stars($nmbStars){

	global $imgDir;

	$sc = new MKShapeContainer();         // the shape
	$rStr = "0123456789ABCDEF";

	for($i = 0; $i < $nmbStars; $i++){
		$x = 14 * $i;
		$y = cos(deg2rad($x)) * 60 + 150;
		$rCol = $rStr[rand(6, 15)];
		$rCol .= $rCol ."0000";

		$sc->add_fillStyle_solid("#" .$rCol);	// fill color, max red value
		$sc->add_star($x, $y, 20, "auto", 5, $i * 10); 		// a circle with radius, x,y
		$sc->increase_shapeDepth();
	}

	$sd = $sc->update_tagData();			// get shape tag
	$po = $sc->update_place_tagData();		// get placing data

	$swf = new MKSwf("test_draw03.swf");	// start a fresh swf
	$swf->set_swfDir(SERVER_MKTMP);			// change default working dir
	$swf->add_tagData($sd);                 // populate with shape
	$swf->add_tagData($po);	                // place on stage
	$swf->swf_output();	                    // save to disk

	$swfHeader = $swf->fetch_assoc();

	$str = render_swf_box($swfHeader, $imgDir, false);
	$str .= "<br/><strong>test_draw03.swf created in" .SERVER_MKTMP ."</strong>";

	return $str;
}

$str = draw_many_stars(200);
echo show_content($str, basename(__FILE__));
?>
